#    One Room And A Goblin Invasion
#    Copyright (C) 2014  Jannik Haberbosch
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.


# 3rd party modules
import pygame
pygame.init()


class CollisionDetectionRectangle( pygame.sprite.Sprite ):
	"""This class is used for creating objects that are used to detect collisions.

	"""
	def __init__( self, width, height, position_center ):
		"""
		Parameters
			width
			integer
			Defines the width of the rectangle
			
			height
			integer
			Defines the height of the rectangle
			
			position_center
			list
			A list consisting of two integer values, defining the center of the
			rectangle that is about to be created.
			[x, y]

		"""
		# We need to call the base-class constructor first.
		pygame.sprite.Sprite.__init__( self )

		self.image = pygame.Surface( ( width, height ) )
		self.rect = self.image.get_rect( center = position_center )


	def update( self, x_movement, y_movement ):
		"""Updates the object.

		Parameters
			x_movement
			integer
			How much to move in the x-plane

			y_movement
			integer
			How much to move in the y-plane
			
		"""
		self.rect.move_ip(
			x_movement,
			y_movement
		)
